package thread;
import java.util.Scanner;
/**
线程阻塞，实现定时器
 程序运行后在控制台输入一个数字，然后从该数字开始每秒递减，到0时输出时间到
 5
 4
 3
 2
 1
 时间到
 */
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        Scanner scan =new Scanner(System.in);
        for (int i=scan.nextInt();i>0;i--) {
            System.out.println(i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
        System.out.println("程序结束了");
    }
}